﻿using AMAP.Domain;
using AMAP.ServiceInterfaces.Common;
using System.Collections.Generic;
using ExternalOffer = AMAP.Areas.Admin.Models.Basket.AdminBasketCreateViewModel.ExternalOffer;

namespace AMAP.ServiceInterfaces
{
    public interface IOtherAmapService : IRepositoryService<Amap>
    {
        /// <summary>
        /// Gets and return an external offer from an amap based on this amap offer id
        /// </summary>
        /// <param name="AmapId">The amap where the original offer has been fund</param>
        /// <param name="OfferId">The external amap offer id</param>
        /// <returns>An ExternalOffer preformated object</returns>
        ExternalOffer GetById(int AmapId, int OfferId);

        /// <summary>
        /// Computes and returns the list of all offers available in other amaps
        /// </summary>
        /// <returns>List of offers of other amaps</returns>
        IList<ExternalOffer> GetLastValidOffers();

        /// <summary>
        /// Add an order in the pointed amap for the given quantity
        /// </summary>
        /// <param name="AmapId">Amap where to order the product</param>
        /// <param name="OfferId">Id of the offer in the amap</param>
        /// <param name="Quantity">Wanted quantity of the product pointed by the offer</param>
        /// <returns>The id of the inserted row</returns>
        int OrderExternalProduct(int AmapId, int OfferId, double Quantity);

        /// <summary>
        /// Update the given list of external orders based on other amap databases connexions
        /// </summary>
        /// <param name="ExternalOrders">The list of orders needed to be update</param>
        void UpdateExternalOrder(IList<ExternalOrder> ExternalOrders);
    }
}
